import type { UserModel } from '@/apis/model/user'
import { useListRequest } from '@/hooks/useListRequest'

import type { IQuery } from '../types'

export default function useTableList(params: IQuery, user?: UserModel) {
  const fn = user ? userDomainGroupListApi : domainGroupListApi

  const {
    data: tableData,
    getList,
    loading,
    pagination
  } = useListRequest(fn, params)

  return {
    tableData,
    getList,
    loading,
    pagination
  }
}
